<?php
$this->headLink()
        ->appendStylesheet($this->APP_STATIC_SERVER . '/skins/' . $this->APP_TEMPLATE . '/' . $this->APP_SKIN . '/css/main.css')
        ->appendStylesheet($this->APP_STATIC_SERVER . '/skins/' . $this->APP_TEMPLATE . '/' . $this->APP_SKIN . '/css/article.css')
        ->appendStylesheet($this->APP_STATIC_SERVER . '/public/js/jquery.jrating/jRating.jquery.css');
$this->headScript()
        ->appendFile($this->APP_STATIC_SERVER . '/public/js/jquery.jrating/jRating.jquery.min.js');
?>
<?php $this->placeholder('slide')->captureStart() ?>
<div class="s-item">
    <div class="s-i-caption">
        <h3>Our Portfolio</h3>
        <p>Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text</p>
    </div>
    <div class="s-i-image">
        <img alt="" src="<?php echo $this->APP_STATIC_SERVER . '/skins/' . $this->APP_TEMPLATE . '/' . $this->APP_SKIN ?>/images/portfolio-banner.png"/>
    </div>
</div>
<?php $this->placeholder('slide')->captureEnd() ?>
<div id="main-outter">
    <?php echo $this->rWidget('category', 'templatecategories', array('featured' => null, 'start_depth' => null, 'end_depth' => 0))?>
    <div id="main">
        <div id="m-left">
            <?php
            /*
             * Add older articles
             *
             */
            echo $this->rWidget('news', 'older', array('article_id' => $this->article->id, 'category_id' => $this->article->category_id, 'limit' => 5));
            /**
             * Add FB Likebox 
             */
            echo $this->rWidget(
                        'core', 
                        'fblikebox',
                        array(
                            'page_url' => 'href=http://www.facebook.com/idgitcomvn',
                            'color_scheme' => 'light',
                            'show_faces' => 'true',
                            'app_id' => '321661271228186',
                            'width' => 250,
                            'height' => 590
                        )
                    );
            ?>
            <!-- facebook likebox-->
            
        </div>
        <div id="m-right">
            <div id="article-details">
                <h3 class="a-title"><?php echo $this->article->title ?></h3>
                <div id="a-vote-social">
                    <?php
                        if($this->article->rating){
                            $rating = Zend_Json::decode($this->article->rating);
                            $num = $rating['num'];
                            $avg = $rating['avg'];

                        }else{
                            $avg = 0;
                            $num = 0;
                        }
                        ?>
                    <span><?php echo $num . ' '. $this->translate('news_article_details_rating')?></span>
                    <div id="a-vote">
                        
                        <div class="jRating" id="<?php echo $avg. '_' . $this->article->id?>"></div>
                    </div>
                    <div id="a-views"><?php echo ($this->article->num_views ? $this->article->num_views : 0). ' '. $this->translate('news_article_details_views')?></div>
                    <div id="a-social">
                        <!-- facebook like -->
                        <iframe src="//www.facebook.com/plugins/like.php?href=<?php echo $this->APP_HOST . $this->url($this->article->getProperties(), 'news_article_details'); ?>&amp;send=false&amp;layout=button_count&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21&amp;appId=321661271228186" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px; height:21px;" allowTransparency="true"></iframe>
                        <!-- twitter follow -->
                        <a href="https://twitter.com/share" class="twitter-share-button" data-url="<?php echo $this->APP_HOST . $this->url($this->article->getProperties(), 'news_article_details'); ?>" data-via="WindyXIII">Tweet</a>
                        <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
                        <!-- goolge pluss -->
                        <g:plusone size="medium" href="<?php echo $this->APP_HOST . $this->url($this->article->getProperties(), 'news_article_details'); ?>"></g:plusone>
                        <script type="text/javascript">
                            (function() {
                                var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
                                po.src = 'https://apis.google.com/js/plusone.js';
                                var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
                            })();
                        </script>
                        
                    </div>
                </div>
                <div class="a-content">
                    <?php echo $this->article->content ?>
                </div>
                <div id="a-comment">
                    <div id="fb-root"></div>
                    <script type="text/javascript">
                        (function(d, s, id) {
                            var js, fjs = d.getElementsByTagName(s)[0];
                            if (d.getElementById(id)) return;
                            js = d.createElement(s); js.id = id;
                            js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId=115416385204584";
                            fjs.parentNode.insertBefore(js, fjs);
                        }(document, 'script', 'facebook-jssdk'));</script>
                    <div class="fb-comments" data-href="<?php echo $this->APP_HOST . $this->url($this->article->getProperties(), 'news_article_details'); ?>" data-num-posts="5" data-width="700px"></div>
                </div>
            </div>
        </div>
        <div class="clearfix"></div>
    </div>
    <div class="clearfix"></div>
</div>
<div class="clearfix"></div>
<?php echo $this->rWidget('news', 'featured', array('limit' => 4, 'category_id' => 59)); ?>
<script type="text/javascript">
    $(document).ready(function(){

        $("#a-vote .jRating").jRating({
            phpPath: '<?php echo $this->url(array(), 'news_article_rate')?>',
            bigStarsPath: '<?php echo $this->APP_STATIC_SERVER . '/public/js/jquery.jrating/icons/stars.png' ?>',
            smallStarsPath: '<?php echo $this->APP_STATIC_SERVER . '/public/js/jquery.jrating/icons/small.png' ?>',
            rateMax: 5,
            decimalLength:0
        });

    });
</script>